package com.extend.spring4;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

@Component
public class MyBeanPostProcessor implements BeanPostProcessor{

	/**
	 * bean属性设置之后初始化方法之前调用
	 */
	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		System.out.println(bean.getClass()+"=============postProcessBeforeInitialization=================");
		return bean;
	}

	/**
	 * bean初始化方法之后调用
	 */
	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		System.out.println(bean.getClass()+"===============postProcessAfterInitialization===============");
		return bean;
	}

}
